//
//  UILabel+Extension.swift
//  01-界面搭建
//
//  Created by Apple on 15/11/5.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit
///便利构造Label
extension UILabel {
       convenience init(Labeltext:String,Textcolor:UIColor = UIColor.darkGrayColor(),Labelfont:CGFloat = 14,screenInset: CGFloat = 0){
        
        self.init()
        //设置文字信息
        text = Labeltext
        textColor = Textcolor
        font = UIFont.systemFontOfSize(Labelfont)
        
        if screenInset == 0 {
            textAlignment = .Center
        }else {
        
        preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInset
            textAlignment = .Left

        }
        numberOfLines = 0
        
        
    }
    
    
}